{% extends 'publisher_list.html' %}

{% block pub_active %}

{% endblock %}

{% block book_active %}
    active
{% endblock %}

{% block main %}
    <h2 class="sub-header">书籍列表 </h2>
    <a class="btn btn-primary btn-sm" href="/book_add/">新增</a>
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>序号</th>
                <th>id</th>
                <th>书名</th>
                <th>出版社</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for book in all_books %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ book.pk }}</td>
                    <td>{{ book.name }}</td>
                    <td>{{ book.publisher.name }}</td>
                    <td>
                        <a class="btn btn-danger btn-sm" href="{% url 'del' 'book' book.pk %}">删除</a>
                        <a class="btn btn-primary btn-sm" href="/book_edit/?id={{ book.pk }}">修改</a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}
